﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace BaiDuSitemap.DBO
{
    public class Setting
    {
        /// <summary>
        /// 获取设置项的值
        /// </summary>
        /// <param name="Attrib">设置名称</param>
        /// <returns>string</returns>
        public static string Get(string Attrib)
        {
            string sql = "select [content] from [QT_Setting] where [Attrib]='" + Attrib + "'";
            DataTable dt = new QT.DBO.OleDBHelper(myDB.connstring).DataTable(sql);

            if (dt.Rows.Count == 0) return "";
            return dt.Rows[0][0].ToString();
        }

        /// <summary>
        /// 
        /// 修改设置项的值
        /// </summary>
        /// <param name="Attrib">设置名称</param>
        /// <param name="value">新值</param>
        /// <returns>int</returns>
        public static int Update(string Attrib, string value)
        {
            string sql = "update [QT_Setting] set [content]='" + value + "' where [Attrib]='" + Attrib + "'";
            return new QT.DBO.OleDBHelper(myDB.connstring).ExecuteNonQuery(sql);
        }
    }
}
